﻿using HamcoWcs.Entitys.WcsLocations;
using HamcoWcs.Models.Common;
using HamcoWcs.Models.Common.Enums;
using HamcoWcs.Models.ForeEndModels.Wms;
using HamcoWcs.Models.TibcoMessage;
using HamcoWcs.Models.TibcoMessage.Items;
using HamcoWcs.Models.WcsLocations;
using System.Collections.Generic;
using System.Threading.Tasks;

namespace HamcoWcs.Contract.ContractCommon
{
    public interface ILocationService 
    {
        Dictionary<string, ShelfInfoDto> GetInventoryShelfInfo();
        List<LocationCascaderDto> GetLocationCascader();

        WcsLocationDto GetEmptyLocation(string zoneName);

        WcsLocation GetEmptyLocationByZone(string zoneName);
        WcsLocation GetEmptyLocationBySrm(string srmName);

        // todo 异常
        WcsLocation GetPalletLocation(string unitId);
        WcsLocation GetMiddleLocation(string aisle);
        WcsLocation GetLocationByWcsName(string wcsName);
        WcsLocationDto GetLocationByWmsName(string wmsName, string aisle);


        List<Zone> InventoryZones();
        Dictionary<string, List<Zone>> InventoryZonesByAisle();
        List<Zone> InventoryZonesByZone(string zoneName);

        List<Pallet> InventoryPallets();
        Dictionary<string, List<Pallet>> InventoryPalletsByZone();

        List<Pallet> GetZonePallets(string zoneName);


        ForeEndResult GetAllLocInfo();
        List<WcsLocation> GetAllLoc();

        bool CheckIsNeedSection(string fromWmsName, string toWmsName, string aisle, out WcsLocationDto floc, out WcsLocationDto tloc);

        EnumWcsShelfZone GetWcsZoneByBay(int bay, string aisle);

        int GetPconNameByWmsLocationName(string wmsName);

        /// <summary>堆垛机占用储位</summary>
        void SrmOccupy(string srmName);

        /// <summary>堆垛机解除占用储位</summary>
        void SrmUnoccupy(string srmName);

        /// <summary>禁用储位</summary>
        void ShelfBlock(string shelfName, string user, string remark = "");
        /// <summary>解除禁用储位</summary>
        void ShelfUnBlock(string shelfName, string user);
        /// <summary>更新储位备注</summary>
        void UpdateShelfRemark(string shelfName, string user, string remark);

        /// <summary>上报MES Zone的使用数量</summary>
        void InventoryZone(string zoneName);

        void InventoryPallet(string zoneName);
        void InventoryPallet(List<string> zoneNames);


        MachineAddressDto GetAddress(string unitId);
        MachineAddressDto GetLocAddress(string locName);
        CurrentPalletModel SearchPallet(string unitId);

    }
}
